package com.za.wbw.dao.wap.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import com.za.wbw.model.wap.ShopInfo;
import com.za.wbw.dao.wap.ShopDao;

public class ShopDaoImpl extends SqlMapClientDaoSupport implements ShopDao{
	private static final Object ShopInfo = null;
	// 查询商店列表
	@SuppressWarnings("unchecked")
	public List<ShopInfo> queryShopList(int start, int cityId, int typeId, int posX, int posY, int radius, int sort) throws Exception{
		Map<String, Object> pars = new HashMap<String, Object>();
		pars.put("start", start);
		pars.put("cityId", cityId);
		pars.put("typeId", typeId);
		List<ShopInfo> list = (List<ShopInfo>)getSqlMapClientTemplate().queryForList("wap.queryShopList",pars);
		return list;
	}
	// 查询商店总数
	public int queryShopCount(int cityId, int typeId, int posX, int posY, int radius, int sort) throws Exception{
		Map<String, Object> pars = new HashMap<String, Object>();
		pars.put("cityId", cityId);
		pars.put("typeId", typeId);
		int total = (Integer)getSqlMapClientTemplate().queryForObject("wap.queryShopCount", pars);
		return total;
	}
	// 查询商店信息
	public ShopInfo queryShopInfoById(int shopId) throws Exception {
		ShopInfo shopInfo = (ShopInfo)this.getSqlMapClientTemplate().queryForObject("wap.queryShopInfo",shopId);
		return shopInfo;
	}
}
